"use client";

import * as AvatarPrimitive from "@radix-ui/react-avatar";
import type * as React from "react";

import { cn } from "@/lib/utils";

function Avatar({
  className,
  ...props
}: React.ComponentProps&lt;typeof AvatarPrimitive.Root&gt;) {
  return (
    &lt;AvatarPrimitive.Root
      data-slot="avatar"
      className={cn(
        "relative flex size-8 shrink-0 overflow-hidden rounded-full",
        className,
      )}
      {...props}
    /&gt;
  );
}

function AvatarImage({
  className,
  ...props
}: React.ComponentProps&lt;typeof AvatarPrimitive.Image&gt;) {
  return (
    &lt;AvatarPrimitive.Image
      data-slot="avatar-image"
      className={cn("aspect-square size-full", className)}
      {...props}
    /&gt;
  );
}

function AvatarFallback({
  className,
  ...props
}: React.ComponentProps&lt;typeof AvatarPrimitive.Fallback&gt;) {
  return (
    &lt;AvatarPrimitive.Fallback
      data-slot="avatar-fallback"
      className={cn(
        "bg-muted flex size-full items-center justify-center rounded-full",
        className,
      )}
      {...props}
    /&gt;
  );
}

export { Avatar, AvatarFallback, AvatarImage };
